package com.springboot.controller.tool;

import cn.hutool.json.JSONArray;
import com.springboot.service.tool.ToolService;
import com.springboot.util.http.ResponseBuilder;
import com.springboot.util.http.ResultResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Classname CardController
 * @Description 证件工具类
 * @Version 1.0.0
 * @Date 2024/4/11 17:43
 * @Created by zyj
 */
@Controller
@RequestMapping("/excel")
@Slf4j
@Tag(name = "excel工具")
public class ExcelController {

    @Resource
    private ToolService toolService;

    @PostMapping(value = "/analysisExcel")
    @Operation(description = "解析excel")
    public ResultResponse<JSONArray> analysisExcel(@RequestPart("file") MultipartFile multipartFiles){
        try {
            return ResponseBuilder.successData(toolService.analysisExcel(multipartFiles));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }


}
